<template>
<a-modal
    v-model="show"
    :centered="true"
    width=50%
    title="表单预览"
    ok-text="确认"
    @cancel="onClose" @ok="handleSubmit">
     <!-- 表单区域 -->
      <fm-generate-antd-form
      :data="jsonData"
      :remote="remoteFuncs"
      :value="editData"
      :remote-option="dynamicData"
      ref="generateForm"
    >
    </fm-generate-antd-form>
</a-modal>
</template>
<script>
export default {
  name: 'ViewForm',
  props: {
    ViewFormVisiable: {
      default: false
    }
  },
  data () {
    return {
      jsonData: {},
      editData: {},
      remoteFuncs: {
      },
      dynamicData: {
      },
      loading: false
    }
  },
  computed: {
    show: {
      get: function () {
        return this.ViewFormVisiable
      },
      set: function () {
      }
    }
  },
  methods: {
    onClose () {
      this.$emit('close')
    },
    setFormValues (data) {
      this.jsonData = JSON.parse(data.formJson)
    },
    handleSubmit () {
      this.$refs.generateForm.getData().then(data => {
        alert(JSON.stringify(data))
      }).catch(e => {
      })
    }
  }
}
</script>
